{extend name="template/base_default"}
{block name="header"}
<link rel="stylesheet" href="__CSS__/common.css">
<link rel="stylesheet" href="__CSS__/wallet_in/style.css">
{/block}
{block name="body"}
<div class="wallet-in-box">
    <div class="wallet-in-item">请选择支付方式</div>
    <div class="wallet-in-way">
        <input type="radio" name="way" id="we_pay" checked>
        <label for="we_pay">微信支付</label>
        &nbsp;&nbsp;&nbsp;&nbsp;
        <input type="radio" name="way" id="ali_pay">
        <label for="ali_pay">支付宝支付</label>
    </div>
    <div class="wallet-in-num">
        <span>输入充值金额:</span>
        <input id="num" type="number" title="">
    </div>
    <button id="wallet_in_btn" class="weui-btn weui-btn_primary">充值库存积分</button>
    <button id="cash_to_stock" class="weui-btn weui-btn_primary">提现积分转库存积分</button>
</div>
{/block}
{block name="footer"}
<script type="text/javascript" src="__JS__/public.js"></script>
<script>
    $('#wallet_in_btn').click(function(){
        var num = $('#num').val();
        var way = $('#we_pay').is(':checked')?'1':'2';
        var form = $('<form></form>');
        var action =getBaseUrl() + '/weixin/user/recharge';
        form.attr({action:action,method:'post',target:'_self'});

        var points = $('<input type="num" name="points" />');
        points.attr('value',num);
        var type = $('<input type="num" name="type" />');
        type.attr('value',way);

        form.append(points);
        form.append(type);
        $('body').append(form);
        form.submit().remove();
    });
    $('#cash_to_stock').click(function(){
        var num = $('#num').val();
        var way = $('#we_pay').is(':checked')?'1':'2';
        var form = $('<form></form>');
        var action =getBaseUrl() + '/weixin/user/cash_to_stock';
        form.attr({action:action,method:'post',target:'_self'});

        var points = $('<input type="num" name="points" />');
        points.attr('value',num);
        var type = $('<input type="num" name="type" />');
        type.attr('value',way);

        form.append(points);
        form.append(type);
        $('body').append(form);
        form.submit().remove();
    });
</script>
{/block}